package com.wskeee.ec.logger
{
	public class Logger
	{
		public static const INFO:uint = 0;
		public static const WARN:uint = 1;
		public static const ERROR:uint = 2;
		public static const DEBUG:uint = 3;
		
		public static var isDebug:Boolean = true;
		private static const LEVELS:Array = ["INFO","WARN","ERROR","DEBUG"];
		
		private static var _instance:Logger;
		
		private static function log(mes:String,level:uint = 0,e:Error=null):void
		{
			if(!isDebug && (level == DEBUG || level == INFO))return;
			e = e ? e : new Error();
			var from:String = e.getStackTrace().match( /[\w\/]*\(\)/g )[ 1 ];
			trace("[EC - "+LEVELS[level]+"] "+"["+from+"] "+mes);
		}
		
		public static function debug(... args) : void
		{
			log(args.join(" "),DEBUG,new Error());
		}
		
		public static function info(... args) : void
		{
			log(args.join(" "),INFO,new Error());
		}
		
		public static function warn(... args) : void
		{
			log(args.join(" "),WARN,new Error());
		}
		
		public static function error(... args) : void
		{
			log(args.join(" "),ERROR,new Error());
		}
	}
}